package com.ugrow.ugrowcommunity.activity.announcement;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.ugrow.ugrowcommunity.R;
import com.ugrow.ugrowcommunity.activity.announcement.bean.AnnouncementBean;

public class ADetailsActivity extends AppCompatActivity {

    private  TextView mTvDTitle,mTvDContent,mTvDAuthor;
    private  ImageView imgBack;

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setStatusBarColor(0xffffff);
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        setContentView(R.layout.activity_a_details);
        initView();
        AnnouncementBean announcementBean = (AnnouncementBean) getIntent().getSerializableExtra("announcementBean"); // 获取传入的公告标题
        String newsTitle = announcementBean.getTitle(); // 获取传入的公告内容
        String newsContent = announcementBean.getContent();
        String newsAuthor = announcementBean.getAuthor();
        String newsTime = announcementBean.getTime();
        mTvDTitle.setText(newsTitle);
        mTvDContent.setText(newsContent);
        mTvDAuthor.setText(newsAuthor+" "+newsTime);
        imgBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    public static void actionStart(Context context, AnnouncementBean announcementBean){
        Intent intent = new Intent(context,ADetailsActivity.class);
        intent.putExtra("announcementBean",announcementBean);
        context.startActivity(intent);
    }


    private void initView(){
        mTvDTitle = findViewById(R.id.tv_dtitle);
        mTvDContent = findViewById(R.id.tv_dcontent);
        mTvDAuthor = findViewById(R.id.tv_dauthor);
        imgBack = findViewById(R.id.ADback);
    }




}